// Tierless
// Copyright © 2010 Alphora
// This file is licensed under a modified BSD-license (see tierless_license.txt).
using System.Runtime.Serialization;

namespace Tierless.Framework.EntityTypes
{
	/// <summary>
	/// Represents an order definition for an entity.
	/// </summary>
	[DataContract]
	public class EntityOrder
	{
		/// <summary>
		/// Gets or sets the title of the order.
		/// </summary>
		[DataMember]
		public string Title { get; set; }

		[DataMember]
		private EntityOrderColumnCollection _columns = new EntityOrderColumnCollection();

		/// <summary>
		/// Gets the collection of column definitions for the order.
		/// </summary>
		public EntityOrderColumnCollection Columns
		{
			get { return _columns; }
		}

		/// <summary>
		/// Gets or sets whether or not the ordering is a superset of a key.
		/// </summary>
		[DataMember]
		public bool IsUnique { get; set; }

		public override string ToString()
		{
			return string.Format("EntityOrder: Title={0}, Columns={1}, IsUnique={2};", Title, Columns, IsUnique);
		}
	}
}